<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/src/css/layui.css}">
</head>
<body>
<form class="layui-form" style="width: 80%;" id="aaf">
    <input type="hidden" name="id" th:value="${ActivityComplainDTO.id}">
    <div class="layui-form-item layui-form-text">
        <!--<label class="layui-form-label">文本域</label>-->
        <div class="layui-input-block">
            <textarea name="context" id="reply" placeholder="请输入回复的内容" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="addReply">立即提交</button>
        </div>
    </div>
</form>
<script th:src="@{/src/layui.js}"></script>
<script>
    layui.use(['form','jquery','layer'],function () {
        var form = layui.form,
            $ = layui.jquery,
            layer = layui.layer;

        //参数data就是表单中的数据
        form.on('submit(addReply)',function (data) {
            //data.field;//当前容器的全部表单字段，名值对形式：{name: value}
            $.ajax({
                url:'/ac_complain/editComplain',
                type:'put',
                dataType:'json',
                data:data.field,
                success:function (result) {
                    if(result.code == 200){
                        layer.msg('回复成功',{icon:1},function () {
                            top.layer.closeAll("iframe");
                            parent.location.reload();
                        })
                    }else{
                        layer.msg(result.message);
                    }
                }
            });
            return false;
        })
    });
</script>

</body>
</html>